// 协作框架测试文件
#include <iostream>
#include "CollaborativeCore/CollaborationProtocol.h"
#include "ModelModuleSystem/ModelComponent.h"
#include "GlobalRegistry/ComponentRegistry.h"

void TestCollaborationFramework() {
    std::cout << "=== AICoder 协作框架测试 ===\n";
    
    // 测试协作消息
    CollaborationMessage msg(CollaborationMessage::MODEL_EDIT, "developer1", "测试消息");
    wxString serialized = msg.Serialize();
    std::cout << "序列化消息: " << serialized.ToStdString() << std::endl;
    
    CollaborationMessage msg2;
    if (msg2.Deserialize(serialized)) {
        std::cout << "反序列化成功: " << msg2.GetContent().ToStdString() << std::endl;
    }
    
    // 测试模型组件
    CModelComponent::ComponentMetadata metadata;
    metadata.name = "TestComponent";
    metadata.version = "1.0.0";
    metadata.author = "test@user";
    metadata.description = "测试组件";
    
    CModelComponent component(metadata, "// 测试组件内容\nvoid test() {}");
    if (component.Validate()) {
        std::cout << "组件验证成功: " << component.GetMetadata().name.ToStdString() << std::endl;
    }
    
    // 测试全局注册表
    auto& registry = CGlobalComponentRegistry::GetInstance();
    auto testComponent = std::make_shared<CModelComponent>(metadata, "测试内容");
    if (registry.RegisterComponent(testComponent)) {
        std::cout << "组件注册成功，总数: " << registry.GetTotalComponentCount() << std::endl;
    }
    
    std::cout << "=== 测试完成 ===\n";
}
